package cn.buk.tms.dto;

import cn.buk.tms.entity.misc.CustomerTpHotel;
import org.springframework.beans.BeanUtils;

import java.util.Date;

/**
 * 企业客户的酒店差旅政策
 * TP - Travel Policy
 */
public class CustomerTpHotelDto extends BaseTpDto {


  private int zoneId;

  /**
   * 最大报销金额
   * 0 - 实报实销
   */
  private int maxReimbursement;

  /**
   * 入住房型
   * 1-一人一间
   * 2-二人一间（同性）
   */
  private int roomType;

  private String remark;

  private Date createTime;

  private Date lastUpdate;

  public static CustomerTpHotelDto createdBy(CustomerTpHotel tpHotel) {
    CustomerTpHotelDto dto = new CustomerTpHotelDto();
    BeanUtils.copyProperties(tpHotel, dto, "customer", "customerPosition");

    dto.setPositionId(tpHotel.getCustomerPosition().getPositionId());
    dto.setPositionName(tpHotel.getCustomerPosition().getName());
    dto.setPositionLevel(tpHotel.getCustomerPosition().getVipLevel());

    return dto;
  }

  public String getZoneDesc() {
    switch (this.zoneId) {
      case 1: return "一类地区";
      case 2: return "二类地区";
      default:
        return "其它地区";
    }
  }

  public String getRoomTypeDesc() {
    switch (this.roomType) {
      case 1: return "一人一间";
      case 2: return "二人一间（同性）";
      default:
        return "未知";
    }
  }

  @Override
  public String toString() {
    return getCustomerId() + ", "
            + getPositionName() + ", "
            + getZoneDesc() + ","
            + getRoomTypeDesc() + ", "
            + getMaxReimbursement() + ", "
            + getRemark();
  }

  public Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }

  public Date getLastUpdate() {
    return lastUpdate;
  }

  public void setLastUpdate(Date lastUpdate) {
    this.lastUpdate = lastUpdate;
  }

  public int getZoneId() {
    return zoneId;
  }

  public void setZoneId(int zoneId) {
    this.zoneId = zoneId;
  }

  public int getMaxReimbursement() {
    return maxReimbursement;
  }

  public void setMaxReimbursement(int maxReimbursement) {
    this.maxReimbursement = maxReimbursement;
  }

  public int getRoomType() {
    return roomType;
  }

  public void setRoomType(int roomType) {
    this.roomType = roomType;
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

}
